package com.itheima.ThreadPrac2;

public class mythread2 extends Thread{
   int count=100;
    @Override
    public void run() {
       while (true)
       {
           synchronized (Thread.class)
           {
               if(count<=10)
               {
                   System.out.println("还剩"+count+"个礼品不在赠送");
                   break;
               }
               else
               {   count--;
                   System.out.println(getName()+"送礼成功还剩下"+count+"个礼品");
               }
           }
       }

    }
}
